import React from 'react';
import {Toast} from 'antd-mobile'
import { getReadMsg } from '../common/service';
import { connect } from 'react-redux';
import { DOCUMENT_TEXT_URL } from '../common/systemParam';

class Document extends React.Component {

	componentDidMount() {
		this.manualEnd();
	}
	
	manualEnd() {
		const { showLoadModal, hideLoadModal } = this.props;
			showLoadModal();
			getReadMsg(this.props.userReducer.flowId) //流程id
			.then((data) => {
				const isOk = data.data;
				hideLoadModal();
				Toast.info(isOk.msg);
				// setTimeout(() => {
				//   window.location.href = DOCUMENT_TEXT_URL;
				// }, 2000);
			})
			.catch((e) => {
				hideLoadModal()
				Toast.info('服务器连接异常');
			})
	}
	
	render() {
		return (
			<div style={{padding: '1.42rem 0.2rem 0 0.2rem'}}>
			</div>
		);
	}
}

function mapStateToProps(state) {
  const { userReducer } = state;
  return {
    userReducer
  };
}

export default connect(mapStateToProps)(Document);


